import java.util.Scanner;

/**
 * @author: gao
 * @create-date: 2025/3/5 16:09
 */

public class Solution {
    public int search(int[] nums, int target){
        int left = 0,right = nums.length-1;
        while(left <= right){
            int mid = (left + right)/2;
            if(nums[mid] > target) right = mid -1;
            else if(nums[mid] < target) left = mid +1;
            else return mid;
        }
        return -1;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextInt()){
            int size = in.nextInt();
            int[] nums = new int[size];
            for (int i = 0; i < size; i++) {
                nums[i] = in.nextInt();
            }
            int target = in.nextInt();
            Solution solution = new Solution();
            System.out.println(solution.search(nums, target));
        }
    }
}